#ifndef  CELL_INC
#define  CELL_INC

#include	"World.h"
#include	"Configure.h"

class Cell
{
	public:
		Cell(World *wm)
		{
			this->wm = wm;

			int xc = CONF::GRAIDNUM / 2;
			int yc = CONF::GRAIDNUM / 2;

			SetLife( xc , yc  - 1 );
			SetLife( xc , yc  );
			SetLife( xc , yc  + 1 );
		}

	private:
		World *wm;
		
	public:
		void SetLife( int x, int y );
		void Clear();
};

class CellCube : public Cell
{
	public:
		CellCube( World *wm ): Cell(wm)
		{
			Clear();

			int xc = CONF::GRAIDNUM / 2;
			int yc = CONF::GRAIDNUM/ 2;

			SetLife( xc - 1, yc  - 1 );
			SetLife( xc - 1, yc  );
			SetLife( xc , yc  - 1 );
			SetLife( xc , yc );
		}
};

class CellSnake : public Cell
{
	public:
		CellSnake( World *wm ):Cell(wm)
		{
			Clear();

			int xc = CONF::GRAIDNUM/ 2;
			int yc = CONF::GRAIDNUM/ 2;

			SetLife( xc + 2, yc + 2 );
			SetLife( xc + 1, yc + 1 );
			SetLife( xc + 0, yc + 0 );
			SetLife( xc - 1, yc - 1 );
			SetLife( xc - 2, yc - 2 );
		}
};

class CellFly : public Cell
{
	public:
		CellFly( World *wm ):Cell(wm)
		{
			Clear();

			int xc = 4;
			int yc = 2;

			SetLife( xc + 0, yc + 0 );
			SetLife( xc + 0, yc + 1 );
			SetLife( xc + 0, yc + 2 );
			SetLife( xc + 1, yc + 2 );
			SetLife( xc + 2, yc + 1 );
		}
};

class CellFrame : public Cell
{
	public:
		CellFrame( World *wm ): Cell(wm)
		{
			Clear();

			int xc = CONF::GRAIDNUM / 2; 
			int yc = CONF::GRAIDNUM / 2;

			SetLife( xc - 1, yc - 1);
			SetLife( xc - 1, yc + 0);
			SetLife( xc - 1, yc + 1);
			SetLife( xc + 0, yc - 1);
			SetLife( xc + 0, yc + 1);
			SetLife( xc + 1, yc - 1);
			SetLife( xc + 1, yc + 0);
			SetLife( xc + 1, yc + 1);
		}
};

#endif   /* ----- #ifndef CELL_INC  ----- */
